<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 125px;
      height: 300px;
      margin-top: 100px;
      margin-bottom: 100px;
      transform-style: preserve-3d;
      /* 透视 */
      perspective: 100000px;
      position: relative;
      transition: all 1s ease;
    }

    .box div {
      /* transition: all 1s ease; */
      position: absolute;
      top: 0;
      left: 0;
      width: 125px;
      height: 300px;
      overflow: hidden;
    }

    .box div:nth-child(1) {
      background: url(./img/my.webp) 0 0;
      transform: translateZ(150px);
    }

    .box div:nth-child(2) {
      background: url(./img/a.jpg) 0 0;
      transform: rotateX(90deg) translateZ(150px);
    }

    .box div:nth-child(3) {
      background: url(./img/my.webp) 0 0;
      transform: rotateX(180deg) translateZ(150px);
    }

    .box div:nth-child(4) {
      background: url(./img/a.jpg) 0 0;
      transform: rotateX(-90deg) translateZ(150px);
    }


    .div2 div:nth-child(1) {
      background: url(./img/my.webp) -125px 0;
    } 

    .div2 div:nth-child(2) {
      background: url(./img/a.jpg) -125px 0;
    }

    .div2 div:nth-child(3) {
      background: url(./img/my.webp) -125px 0;
    }

    .div2 div:nth-child(4) {
      background: url(./img/a.jpg) -125px 0;
    }


    .div3 div:nth-child(1) {
      background: url(./img/my.webp) -250px 0;
    }

    .div3 div:nth-child(2) {
      background: url(./img/a.jpg) -250px 0;
    }

    .div3 div:nth-child(3) {
      background: url(./img/my.webp) -250px 0;
    }

    .div3 div:nth-child(4) {
      background: url(./img/a.jpg) -250px 0;
    }


    .div4 div:nth-child(1) {
      background: url(./img/my.webp) -375px 0;
    }

    .div4 div:nth-child(2) {
      background: url(./img/a.jpg) -375px 0;
    }

    .div4 div:nth-child(3) {
      background: url(./img/my.webp) -375px 0;
    }

    .div4 div:nth-child(4) {
      background: url(./img/a.jpg) -375px 0;
    }


    .content {
      display: flex;
      width: 500px;
      overflow: hidden;
    }
  </style>
</head>

<body>
  <div class="content">
    <div class="box div1">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
    <div class="box div2">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
    <div class="box div3">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
    <div class="box div4">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
  </div>
  <button class="next">下一张</button>
  <button class="pre">上一张</button>
</body>
<script src="./js/jquery-1.12.4.js"></script>
<script>
  let div1 = $(".div1");
  let div2 = $(".div2");
  let div3 = $(".div3");
  let div4 = $(".div4");
  var nextButton = $("button.next");
  var preButton = $("button.pre");
  let n = 0;

  init();
  function init() {
    //设置
  }

  nextButton.click(function () {
    n++;
    render();
  })
  preButton.click(function () {
    n--;
    render();
  })
  function render() {
    let deg = n * (-90);
    div1.css("transform", `rotateX(${deg}deg)`);
    setTimeout(() => {
      div2.css("transform", `rotateX(${deg}deg)`);
    }, 100);
    setTimeout(() => {
      div3.css("transform", `rotateX(${deg}deg)`);
    }, 200);
    setTimeout(() => {
      div4.css("transform", `rotateX(${deg}deg)`);
    }, 300);
  }
</script>

</html>